home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / ntkb.zip / NTKB.EXE / Q111 / 8 / 55.TXT < prev   
Text File  |  1994-03-01  |  5KB  |  107 lines

  1. DOCUMENT:Q111855  28-FEB-1994  [W_NT]
  2. TITLE   :Maximum Number of Sockets an Application Can Use
  3. PRODUCT :Windows NT
  4. PROD/VER:3.10
  5. OPER/SYS:WINDOWS
  6. KEYWORDS:
  7.  
  8. --------------------------------------------------------------------------
  9. The information in this article applies to:
  10.  
  11.  - Microsoft Windows NT operating system version 3.1
  12.  - Microsoft Windows NT Advanced Server version 3.1
  13. --------------------------------------------------------------------------
  14.  
  15. SUMMARY
  16. =======
  17.  
  18. The maximum number of sockets supported by a particular Windows Sockets
  19. supplier is implementation-specific. An application should make no
  20. assumptions about the availability of a certain number of sockets.
  21.  
  22. MORE INFORMATION
  23. ================
  24.  
  25. Details of the Windows Sockets implementation are described in the WSAData
  26. structure returned by WSAStartup() and defined as follows:
  27.  
  28. struct WSAData {
  29.      WORD          wVersion;
  30.      WORD          wHighVersion;
  31.      char           szDescription[WSADESCRIPTION_LEN+1];
  32.      char          szSystemStatus[WSASYSSTATUS_LEN+1];
  33.      unsigned short     iMaxSockets;
  34.      unsigned short     iMaxUdpDg;
  35.      char FAR *     lpVendorInfo
  36. };
  37.  
  38. On return from WSAStart() on Windows NT
  39.  
  40.    iMaxSockets = 0x7fff (32767)
  41.  
  42. where iMaxSockets is the maximum number of sockets that a single process
  43. can potentially open. A Windows Sockets implementation can provide a global
  44. pool of sockets for allocation to any process, or it can allocate per-
  45. process resources for sockets. The number can reflect the way in which the
  46. Windows Sockets DLL or the networking software was configured. The number
  47. can also be used when writing an application as an indication of whether
  48. the Windows Sockets implementation can be used by the application.
  49.  
  50. For example, an X Windows server might check iMaxSockets when it starts. If
  51. the number of sockets is less than 8, the application displays an error
  52. message instructing the user to reconfigure the networking software. (This
  53. is a situation in which the szSystemStatus text might be used.) There is no
  54. guarantee that a particular application can actually allocate iMaxSockets
  55. sockets, because there may be other Windows Sockets applications in use.
  56.  
  57. However, independent of the number of sockets supported by a particular
  58. implementation is the issue of the maximum number of sockets that an
  59. application can actually use.
  60.  
  61. The maximum number of sockets that a Windows Sockets application can use is
  62. determined at compile time by the manifest constant FD_SETSIZE. To do this,
  63. from the Win32 SDK WINSOCK.H file:
  64.  
  65. /*
  66.  * Select uses arrays of SOCKETs. These macros manipulate such
  67.  * arrays. FD_SETSIZE may be defined by the user before including
  68.  * this file, but the default here should be >= 64.
  69.  *
  70.  * CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
  71.  * INCLUDED IN WINSOCK.H EXACTLY AS SHOWN HERE.
  72.  */
  73. #ifndef FD_SETSIZE
  74. #define FD_SETSIZE      64
  75. #endif /* FD_SETSIZE */
  76.  
  77. This value is used in constructing the fd_set structures used in select().
  78. The default value in WINSOCK.H is 64. If an application is designed to be
  79. capable of working with more than 64 sockets, define the manifest
  80. FD_SETSIZE in every source file before including WINSOCK.H. One way of
  81. doing this is to include the definition within the compiler options in the
  82. makefile, such as adding -DFD_SETSIZE=128 as an option to the compiler
  83. command line for Microsoft C.
  84.  
  85. NOTE: Defining FD_SETSIZE as a particular value has no effect on the actual
  86. number of sockets provided by a Windows Sockets implementation.
  87.  
  88. Additional reference words: 3.10
  89. KBCategory:
  90. KBSubCategory: tcpip netsrv
  91.  
  92.  
  93. =============================================================================
  94.  
  95. THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
  96. PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.  MICROSOFT DISCLAIMS
  97. ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
  98. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
  99. EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
  100. ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
  101. CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
  102. MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
  103. POSSIBILITY OF SUCH DAMAGES.  SOME STATES DO NOT ALLOW THE EXCLUSION
  104. OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
  105. SO THE FOREGOING LIMITATION MAY NOT APPLY.
  106.  
  107. Copyright Microsoft Corporation 1994.